die "Usage: update.pl [ -cats | -applets | -soft | -prod | -all | -dir dirname | -x86 | -report | -html | -names | -check]\n\tall: = -cats -prod -applets\n\tapplets: creates an applet in the customer home page.\n\tcats: creates the category and company pages.\n\tcheck: check the _info file, and other things for errors.\n\tdir: gives the directory where the companies are located.\n\thtml: when -report is selected, creates an output in HTML format.\n\tnames: create list of company names keyed on directory name.\n\tprod: creates the product page.\n\treport: creates a report for all companies.\n\tsoft: creates the Software pages\n\tx86: for future usage.\n";
} else {
die "Unrecognized switch: $_ (try -?)\n";
}
}
&PrintHtml("<HTML> <HEAD> <title>Sun Solutions - status on " . `date` . "</title> </HEAD> <BODY BACKGROUND=../SunSolutions/images/back3.gif bgcolor=\"#DDDDDD\"><H1>", "Sun Solutions - status on " . `date` . "\n", "</H1>");
# check if root user
if ( $ENV{"USER"} ne "root" ) {
&PrintHtml("", "WARNING: This program should be run as root user.\n", "<BR>");
}
if ($REPORT ne "true") {
$HostName = `hostname`;
chop $HostName;
&PrintHtml("", "\nUpdating Sun Solutions on $HostName:\n\n", "<BR>");
if (open (REPORTFILE, ">> $PRODUCTS_DIR/.update.txt")) {
$Date = `date`;
chop $Date;
print REPORTFILE "update by " . $ENV{"USER"} . " on $Date from $HostName\n\tparams: ";
while (@ARGREPORT) {
print REPORTFILE "$ARGREPORT[0], ";
shift @ARGREPORT;
}
print REPORTFILE "\n\n";
close (REPORTFILE);
} else {
&PrintHtml("", "WARNING: Cannot open $PRODUCTS_DIR/.update.txt\n", "<BR>");
}
}
&InitCompInfo();
$CAT_DIR = "$PRODUCTS_DIR/categories";
$FRAMEBASICNAME = "SunSolutions.frame.html";
$HEADBASICNAME = "SunSolutions.head.html";
#print $CAT_DIR;
if ( ! -d $CAT_DIR ) {
mkdir($CAT_DIR, 0777);
}
if ( $CHECK eq "true" ) {
&CheckFiles();
}
if ( $NAMES eq "true" ) {
&CreateNames();
}
if ( $CHECKLINKS eq "true" ) {
&CheckLinks();
}
if ( $CATS eq "true" ) {
&CreateCat();
}
if ( $SOFT eq "true" ) {
&CreateSoft();
}
#
# Get all SunSolutions menu bar components and put in file
# for building of front page applet
#
if ( $APPLETS eq "true" ) {
&CreateApplet();
}
if ( $PROD eq "true" ) {
&CreateProduct();
}
if ( $REPORT eq "true" ) {
&CreateReport();
}
#
# Compile list of companies, place in 'companies' file
#
#if ( $COMP eq "true" ) {
#&CreateComp();
#}
#
# Compile list of products, place in 'products' file
#
#print "\n\n\nPress <RETURN> to close the window and test your submission..\n.";